﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace groupAnalyzer.model
{
    public class Factory
    {
        private List<Node> nodes;
        private List<NodeConnection> nodeConnections;
        private List<Node> rootNodes;
        private List<Group> groups;

        private List<AbstractElementLdap> tree;

        public List<Group> getGroups()
        {
            return this.groups;
        }

        public User constructUser(string username, string department, string email, string fqdn)
        {
            User user = new User(username, department, email, fqdn);

            return user;
        }

        public void resetGroups()
        {
            this.groups.Clear();
        }

        public Node constructRootNode(string name, string fqdn, string description, string email, string groupScope, string groupType, string notes)
        {
            Node rootNode = this.constructNode(name, fqdn, description, email, groupScope, groupType, notes);
            this.rootNodes.Add(rootNode);
            return rootNode;
        }

        public List<Node> getNodes()
        {
            return this.nodes;
        }

        public List<Node> getRootNodes()
        {
            return this.rootNodes;
        }

        public Container constructContainer(string name, string fqdn)
        {
            Container container = new Container(fqdn, name);
            return container;
        }

        public Group constructGroup(string nameOfGroupL, string fqdn)
        {
            Group group = new Group(nameOfGroupL, fqdn);
            this.groups.Add(group);
            return group;
        }

        public List<NodeConnection> getNodeConnections()
        {
            return this.nodeConnections;
        }

        public void reset()
        {
            this.nodes.Clear();
            this.rootNodes.Clear();
        }

        public Node constructNode(string name, string fqdn, string description, string email, string groupScope, string groupType, string notes)
        {
            Node node = new Node(name, fqdn, description, email, groupScope, groupType, notes);
            this.nodes.Add(node);
            return node;
        }

        public Factory()
        {
            this.nodes = new List<Node>();
            this.rootNodes = new List<Node>();
            this.groups = new List<Group>();
            this.tree = new List<AbstractElementLdap>();
            this.nodeConnections = new List<NodeConnection>();
        }
    }
}
